package yichang;

public class Student {
	private String name;
	private int age;

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public int getAge() {
		return age;
	}

	public void setAge(int age) throws AgeException {
		if (age < 0)
			throw new AgeException();
		this.age = age;
	}
}

class AgeException extends Exception {
	private static final long serialVersionUID = 1L;

	public String getMessage() {
		return "年龄不能为负数";
	}
}
